import axios from 'axios'

import { IFiled } from '../interface'
import './__mock__'

/** 获取运单动态字段 */
export const apiGetWaybillDynamicfields = async (waybillNo: string): Promise<IFiled[]> => {
  return axios.post(`/tmsapi/waybill_field/listWaybillField`, { waybillNo }).then(res => res.$data || [])
}

/** 保存运单动态字段 */
export const apiSaveWaybillDynamicfield = async (
  req: { waybillNo: string } & Pick<IFiled, 'attrKey' | 'attrValue'>,
) => {
  await axios.post(`/tmsapi/waybill_field/saveWaybillField`, req)
}
